package com.sharemarking.application.wechat.api;

import com.sharemarking.application.common.api.ResponseParams;
import com.sharemarking.application.wechat.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/10/16.
 */
@RestController
@RequestMapping(value = "api/client")
public class ClientApi {

    @Autowired
    ClientService clientService;

    /**
     * 登录/注册
     * @param request
     * @return
     */
    @RequestMapping("login")
    public ResponseParams login(HttpServletRequest request) {
        ResponseParams responseParams = new ResponseParams();
        try {
            responseParams = clientService.login(request);
            return responseParams;
        } catch (Exception e) {
            e.printStackTrace();
            responseParams.isError();
            return responseParams;
        }
    }

}
